home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGIALS / TCTUTOR.LZH / TCTUTOR.ZIP / BACKWARD.C < prev    next >
C/C++ Source or Header  |  1987-07-04  |  678b  |  27 lines

  1.                                          /* Chapter 5 - Program 6 */
  2. #include "stdio.h"      /* Prototypes for standard Input/Output   */
  3. #include "string.h"     /* Prototypes for string operations       */
  4.  
  5. void forward_and_backwards(char line_of_char[],int index);
  6.  
  7. main()
  8. {
  9. char line_of_char[80];
  10. int index = 0;
  11.  
  12.    strcpy(line_of_char,"This is a string.\n");
  13.  
  14.    forward_and_backwards(line_of_char,index);
  15.  
  16. }
  17.  
  18. void forward_and_backwards(char line_of_char[],int index)
  19. {
  20.    if (line_of_char[index]) {
  21.       printf("%c",line_of_char[index]);
  22.       index++;
  23.       forward_and_backwards(line_of_char,index);
  24.    }
  25.    printf("%c",line_of_char[index]);
  26. }
  27.